package com.yzh.IOCDI.controller;

import com.yzh.IOCDI.component.UserComponent;
import com.yzh.IOCDI.service.UserSevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.net.PortUnreachableException;
import java.net.URLConnection;

@Controller
public class HelloController {
//    @Autowired
//    //属性注入
//    private UserSevice userService;
//    public void sayHi(){
//        userService.doService();
//        System.out.println("hi helloconctroller!");
//    }

    //构造方法注入
    private UserSevice userSevice;
    public  HelloController(UserSevice userSevice){
        this.userSevice = userSevice;
    }
    public HelloController(){

    }
    private UserComponent userComponent;
    public HelloController(UserSevice userSevice, UserComponent userComponent){
        this.userSevice = userSevice;
        this.userComponent = userComponent;
    }
   // @Controller：控制层, 接收请求, 对请求进⾏处理, 并进⾏响应.
    public void hello(){
        System.out.println("hehe");
    }
}
